package cn.bs.busuo.account.dao.persist.repository.impl;

import cn.bs.busuo.account.dao.persist.mapper.TagMapper;
import cn.bs.busuo.account.dao.persist.mapper.UserCharacterMapper;
import cn.bs.busuo.account.dao.persist.repository.ITagRepository;
import cn.bs.busuo.account.pojo.vo.AllTagVO;
import cn.bs.busuo.account.pojo.vo.UserCharacterVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.time.LocalDateTime;
import java.util.List;

@Repository
public class TagRepositoryImpl implements ITagRepository {
    @Autowired
    private UserCharacterMapper userCharacterMapper;
    @Autowired
    private TagMapper tagMapper;

    @Override
    public int AddNewTag(Long id, List<Long> characterIds, LocalDateTime localDateTime) {
        return userCharacterMapper.insertMany(id,characterIds,localDateTime,localDateTime);
    }

    @Override
    public int selectTagIfExits(List<Long> characterIds) {
        return tagMapper.selectTagIfExits(characterIds);
    }
    @Override
    public int selectUserTagIfExits(Long userId,List<Long> characterIds){
        return userCharacterMapper.selectUserTagIfExits(userId,characterIds);
    }

    @Override
    public List<UserCharacterVO> listTag(Long id) {
        return userCharacterMapper.listTag(id);
    }

    @Override
    public int deleteTag(Long id, List<Long> characterId) {
        return userCharacterMapper.deleteTagById(id,characterId);
    }

    @Override
    public List<AllTagVO> listAllTag() {
        return tagMapper.listAllTag();
    }

}
